﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:local="clr-namespace:FIFP.DashBoard.Views"
    xmlns:my="clr-namespace:SilverFlow.Controls;assembly=SilverFlow.Controls"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    DataContext="{Binding ImportVM,Source={StaticResource ServiceLocator}}"
	x:Class="FIFP.DashBoard.Views.Import"
    mc:Ignorable="d"    
    xmlns:vm="clr-namespace:FIFP.DashBoard.ViewModel"    
    d:DesignHeight="600" d:DesignWidth="1000">

   
    <Grid x:Name="LayoutRoot">
        
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Loaded">
                <i:InvokeCommandAction Command="{Binding ImportPageLoadCommand}" 
        							CommandParameter="{Binding ElementName=grdChild}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
       
        <Grid Margin="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="210"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
           
            <ScrollViewer Grid.Column="0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Style="{StaticResource ScrollViewerStyle1}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <RadioButton Name="rdFilter" Grid.Row="0" Tag="filter" IsEnabled="{Binding IsFilterButtonEnabled}" Command="{Binding Path=FilterButtonVisibilityCommand}" CommandParameter="{Binding ElementName=rdFilter}" Content="Filter" Margin="0,0,0,1" Height="25" Style="{StaticResource RadioButtonLeftSideStyleMenu}" />
                    <Grid Grid.Row="1" Visibility="{Binding FilterVisibility}">
                        <local:UCFilter x:Name="ucFilter"></local:UCFilter>
                    </Grid>
                    <RadioButton Name="rdUnitFilter" Grid.Row="2" Tag="filtertree" IsEnabled="{Binding IsFilterButtonEnabled}" Command="{Binding Path=FilterButtonVisibilityCommand}" CommandParameter="{Binding ElementName=rdUnitFilter}" Content="Unit Filter" Margin="0,0,0,1" Height="25" Style="{StaticResource RadioButtonLeftSideStyleMenu}" />
                    <Grid Grid.Row="3" Margin="0,10,0,5" Visibility="{Binding FilterTreeVisibility}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                            <RowDefinition Height="Auto"></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Grid.Row="0" TextWrapping="Wrap" Text="Enter UnitName" Style="{StaticResource SmallHeading}" VerticalAlignment="Top" Margin="0,0,0,4"/>
                        <TextBox Grid.Row="1" Text="{Binding UnitName, Mode=TwoWay, ValidatesOnNotifyDataErrors=True,NotifyOnValidationError=True, UpdateSourceTrigger=Default}" MaxLength="100" Margin="0,2,0,0" Style="{StaticResource TextBoxStyle1}" TextWrapping="Wrap" Height="25" Width="205" />
                        <Button x:Name="btnFilter" Grid.Row="2" Content="Filter" Command="{Binding Path=UnitFilterCommand}" CommandParameter="{Binding ElementName=btnFilter}"  Margin="0,5,0,5" Width="160" Style="{StaticResource ButtonStyleNew}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    </Grid>
                </Grid>
            </ScrollViewer>

            <Grid Margin="10,0,0,0" Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid Margin="0,23,0,0" Height="27">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Button Name="btnImport" Tag="import" Content="Import the original plan" Visibility="Collapsed" Margin="0,0,30,0" Width="160" Style="{Binding ImportStyle}">
                        <i:Interaction.Triggers>
                            <i:EventTrigger  EventName="Click">
                                <i:InvokeCommandAction Command="{Binding SaveCommand}" 
        							CommandParameter="{Binding ElementName=btnImport}"  />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>


                    

                    <!--<Button Tag="open" Name="btnOpen" Command="{Binding Path=openCommand}" CommandParameter="{Binding ElementName=btnOpen}" 
                            Margin="0,0,30,0" Width="40"  Height="40" Grid.Column="2">
                        <Button.Content>
                            <StackPanel>
                                <Image Margin="0,0,0,10" Source="/FIFP.DashBoard;component/Images/open.png" 
                                       Stretch="Fill" Height="40" RenderTransformOrigin="0.5,0.5" Width="40">
                                </Image>
                            </StackPanel>
                        </Button.Content>
                        
                        <telerik:RadContextMenu.ContextMenu>
                            <telerik:RadContextMenu EventName="Click" ItemsSource="{Binding OpenMenuItems}">
                                <telerik:RadContextMenu.ItemTemplate>
                                    <telerik:HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
                                        <TextBlock Text="{Binding Text}" />
                                    </telerik:HierarchicalDataTemplate>
                                </telerik:RadContextMenu.ItemTemplate>
                            </telerik:RadContextMenu>
                        </telerik:RadContextMenu.ContextMenu>
                    </Button>

                    <Button Tag="save" Name="btnSave" Command="{Binding Path=saveCommand}" CommandParameter="{Binding ElementName=btnSave}" 
                            Margin="0,0,30,0" Width="40"  Height="40" Grid.Column="4">
                        <Button.Content>
                            <StackPanel>
                                <Image Margin="0,0,0,10" Source="/FIFP.DashBoard;component/Images/save.png" 
                                       Stretch="Fill" Height="40" RenderTransformOrigin="0.5,0.5" Width="40">
                                </Image>
                            </StackPanel>
                        </Button.Content>
                        <telerik:RadContextMenu.ContextMenu>
                            <telerik:RadContextMenu EventName="Click">
                                <telerik:RadMenuItem Header="Copy" />
                                <telerik:RadMenuItem Header="Paste" />
                                <telerik:RadMenuItem Header="Cut" />
                                <telerik:RadMenuItem IsSeparator="True" />
                                <telerik:RadMenuItem Header="Select All" />
                            </telerik:RadContextMenu>
                        </telerik:RadContextMenu.ContextMenu>
                    </Button>-->



                    <Button Tag="original" Name="btnOriginal" Command="{Binding Path=LoadOriginalPlansEvent}" CommandParameter="{Binding ElementName=btnOriginal}" Content="Open Raw data" Margin="0,0,30,0" Width="160" Style="{Binding OpenRawDataStyle}" Grid.Column="1" />
                    <Button Tag="basic" Name="btnBasic" IsEnabled="{Binding IsBaseScenarioEnabled}" Command="{Binding Path=BasicScenarioCommand}" CommandParameter="{Binding ElementName=btnBasic}" Content="Open Basic Scenario" Margin="0,0,30,0" Width="160" Style="{Binding OpenBaseScenarioStyle}" Grid.Column="2" />
                    <Button Tag="scenario" Name="btnScenario" Command="{Binding Path=ScenarioCommand}" CommandParameter="{Binding ElementName=btnScenario}" Content="Open Scenario..." Margin="0,0,30,0" Width="160" Style="{Binding ScenarioStyle}" Grid.Column="3" />
                    <Button Tag="saveas" Name="btnSaveAs" IsEnabled="{Binding IsSaveAsEnabled}" Command="{Binding Path=SaveAsCommand}" CommandParameter="{Binding ElementName=btnSaveAs}" Content="Save as" Margin="0,0,30,0" Width="140" Style="{Binding SaveAsStyle}" Grid.Column="4" />
                    <Button Tag="save" Name="btnSave" IsEnabled="{Binding IsSaveEnabled}" Command="{Binding Path=SaveCommand}" CommandParameter="{Binding ElementName=btnSave}"  Content="Save" Margin="0,0,30,0" Width="140" Style="{Binding SaveStyle}" Grid.Column="5" />
                    <Button Tag="calculate" Name="btnCalculate" Command="{Binding Path=CalculateCommand}" CommandParameter="{Binding ElementName=btnCalculate}"  Content="Calculate" Margin="0,0,30,0"  Width="100" Style="{Binding SaveStyle}" Grid.Column="6" />
                </Grid>
                <Path Data="M25.666672,37 L204.34454,37" Margin="0,20,0,0" Grid.Row="1" Stretch="Fill" StrokeThickness="1" UseLayoutRounding="False" VerticalAlignment="Top" Height="1" Stroke="{StaticResource LineColor}"/>
                <Grid Margin="0,10,0,0" Grid.Row="2">
                    <!--<ScrollViewer Style="{StaticResource ScrollViewerStyleSMUR}">-->
                    <local:UCAppointment_New x:Name="ucAppointment" />
                    <!--</ScrollViewer>-->
                    <!--<Rectangle HorizontalAlignment="Left" Height="21" Margin="0,37,0,0" StrokeThickness="1" Visibility="Collapsed" VerticalAlignment="Top" Width="97" Fill="#FF303440"/>
        				<Rectangle HorizontalAlignment="Left" Height="21" Margin="0,37,0,0" StrokeThickness="1" Visibility="Collapsed" VerticalAlignment="Top" Width="96" Fill="#FF303440"/>-->
                </Grid>
            </Grid>

            <!--<my:FloatingWindowHost x:Name="host" Width="Auto" Height="Auto" Grid.ColumnSpan="2" Canvas.ZIndex="1000" />-->
            <controlsToolkit:BusyIndicator x:Name="GLMainPageBusyIndicator" IsBusy="{Binding IsLoading}" DisplayAfter="0" Grid.ColumnSpan="2" >
               
            </controlsToolkit:BusyIndicator>
        </Grid>
        <my:FloatingWindowHost x:Name="host" Width="Auto" Height="Auto" Canvas.ZIndex="1000" />
    </Grid>
    
</UserControl>
